<?php
//引入链接数据库文件
require_once "./conn.php";
if (isset($_POST['save'])){
    // 收集表单传递的数据
    $username =$_POST['username'];
    $email =$_POST['email'];
    $mobile =$_POST['mobile'];
    //echo $username."---".$email."---".$mobile;
    //构造sql语句，插入数据
$sql="insert into users(name,email,mobile)values('$username','$email','$mobile')";
//echo $sql;
if (mysqli_query($link,$sql)) {
    //当插入成功时
    header("Location: index.php");
    exit;
} else {
    //当插入失败时
    echo 'Error:'.mysqli_error($link);

}
mysqli_close($link);
}

?>